package com.lovo.user.controller;

import com.lovo.common.bean.UserInfoBean;
import com.lovo.common.result.ResponseResult;
import com.lovo.common.util.MQUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@ResponseResult
@RequestMapping("/mq")
public class MQController {
    @Resource
    private MQUtil mqUtil;
    @GetMapping("/direct")
    public Object directSend(String exchangeName,String routingKey,String message){
        mqUtil.send(exchangeName,routingKey,message);
        return null;
    }
    @PostMapping("/direct_user")
    public Object directSend(String exchangeName, String routingKey, @RequestBody UserInfoBean userInfoBean){
        mqUtil.send(exchangeName,routingKey,userInfoBean);
        return null;
    }
    @GetMapping("/topic")
    public Object topicSend(String exchangeName,String routingKey,String message){
        mqUtil.send(exchangeName,routingKey,message);
        return null;
    }
    @GetMapping("/fanout")
    public Object fanoutSend(String exchangeName,String message){
        mqUtil.send(exchangeName,"",message);
        return null;
    }
}
